<template>
	<view style="background-color: #f7f7f7;height: 100vh;padding-top: 20rpx;">
		<view class="lis">
			<view class="dis_f aic" style="padding-bottom: 30rpx;">
				<view style="font-size: 30rpx;">
					账户剩余金额{{jinebla}}元
				</view>

				<view class="guiz ml20" @click="showxieyi=true">
					规则
				</view>
			</view>
			<view class="dis_f aic jub" style=" padding: 30rpx 0;   border-top: 1px solid #efefef;">
				<view class="dis_f aic">
					<text style="font-size: 62rpx;
    color: #feb746;">¥</text>
					<input type="digit" placeholder="请输入提现金额" v-model="price">
				</view>
				<text class="c6 fs26" @click="quanbu">全部</text>
			</view>
		</view>
		<u-popup :show="showxieyi" @close="close" @open="open" round="15" mode="center" width="600rpx"
			height="800rpx" closeable="true" mask-close-able="true">
			<view style="padding: 28rpx;">
				<view class="" style="text-align: center;font-size: 32rpx;font-weight: 600;">
					规则
				</view>
				<view class="" style="padding-top: 30rpx;" v-html="xuzhitext">
				</view>
			</view>
		</u-popup>
		<view class="tixian dis_f aic juc" @click="tixan">
			提交申请
		</view>

		<view class="" style="margin-top: 50rpx;">
			<view class="zanwu" v-if="list.length == 0">
				暂无数据
			</view>
			<view class="list" v-for="(item,index) in list" :key="index" @click="zhitui(item)">

				<view class="dis_f aic jub top">
					<view class="" style="padding-left: 15rpx;">
						<view class="">
							{{item.remark}}
							<text class="fs24" style="color: #ccc;padding-left: 15rpx;" v-if="item.status == -1">		{{item.sh_remark}}</text>
						</view>
						<view class="time">
							{{item.addtime}}
						</view>
					</view>
					<view class="tuig">
						{{item.price}}
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showxieyi: false,
				price: "",
				user: "",
				xuzhitext: "",
				array: [],
				yhk_title: '选择银行',
				index: 0,
				yhk: "",
				yhk_name: "",
				wangzhan: "",
				list: [],
				jinebla: 0.00,
				page: 1,
				pageConten: 0,
			}
		},
		onLoad() {
			this.user = uni.getStorageSync('userInfo')
			this.list = []
			this.page = 1
			this.postyunh()
		},
		onReachBottom() {
			if (this.page < this.pageConten) {
				this.page++
				this.postyunh()
			} else if (this.page == this.pageConten) {
				this.loadstatus = '没有更多了'
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.list = []
			this.page = 1
			this.postyunh()
			uni.stopPullDownRefresh(); //停止刷新
			// this.xialashow = true
		},
		methods: {
			open() {
				// console.log('open');
			},
			close() {
				this.showxieyi = false
				// console.log('close');
			},
			postyunh() {
				this.api.post('user/getMyWalletInfo').then(res => {
					console.log(res);
					if (res.code == 200) {

						this.xuzhitext = res.ext.rep.tx_remark
						this.jinebla = res.ext.rep.max_price
						this.pageConten = res.ext.pageCount

						this.list = this.list.concat(res.data);
						this.page >= this.pageConten ? this.loadstatus = '没有更多了' : this.loadstatus = '上拉加载更多'

					}
				})

			},
			bindPickerChanges(e) {
				console.log(e)

				this.index = e.detail.value;
				this.yhk_title = this.array[this.index].name
			},

			quanbu() {
				this.price = this.jinebla
			},
			// 提现
			tixan() {
				let that = this
				if (this.price == '') {
					uni.showToast({
						icon: 'none',
						title: '请输入提现金额'
					})
				} else {
					this.api.post('user/submitAtPrice', {
						price: this.price,
					}).then(res => {
						console.log(res);
						if (res.code == 200) {
							uni.showToast({
								icon: 'none',
								title: '提交成功,审核中...'
							})
							that.list = []
							that.page = 1
							that.postyunh()
						
						}else if(res.code == 322) {
							uni.showToast({
								icon: 'none',
								title: res.message
							})
							setTimeout(function() {
								uni.navigateTo({
									url:'/pagesA/my_user_information/my_user_information'
								})
							},800)
						}
					})
				}

			},
		}
	}
</script>

<style>
	.time {
		color: #a9a9a9;
		font-size: 24rpx;
		padding-top: 20rpx;
	}

	.tuig {
		font-size: 24rpx;
		color: red;
	}

	.tabzhon {
		position: relative;
		color: #feb746;
		font-size: 28rpx;
		font-weight: bold;
	}

	.tabzhon:before {
		content: '';
		position: absolute;
		bottom: -20rpx;
		width: 167rpx;
		height: 2px;
		background-color: #feb746;
		transform: translateX(-50%);
		left: 50%;
	}

	.tab {
		font-size: 28rpx;
	}

	.list {
		padding: 15rpx 20rpx;
		background: #fff;
		margin-bottom: 20rpx;
	}

	.list image {
		width: 100rpx;
		height: 100rpx;
	}

	.bottoms {
		background: #fff;
		padding: 30rpx;
	}

	input {
		width: 493rpx;
		margin-left: 15rpx
	}

	.guiz {
		border: 1px solid #feb746;
		border-radius: 60rpx;
		font-size: 22rpx;
		padding: 0 10rpx;
		color: #feb746;
	}

	.lis {
		background-color: #fff;
		padding: 25rpx 15rpx 0;
		margin: 0 25rpx 25rpx;
		border-radius: 12rpx;
	}

	.tixian {
		background-color: #feb746;
		color: #fff;
		height: 90rpx;
		font-size: 36rpx;
		width: 92%;
		margin-left: 30rpx;
		border-radius: 60rpx;
		margin-top: 50rpx;
	}
</style>